import { combineReducers } from '@reduxjs/toolkit';
import { persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import userReducer from './modules/user';
import themeReducer from './modules/theme';
import permissionReducer from './modules/permission';
import tabsReducer from './modules/tabs';

const persisKeys = 'SLOTHADMIN';

// 配置reducer
const reducer = combineReducers({
  user: userReducer,
  permission: permissionReducer,
  theme: persistReducer({ storage, key: persisKeys + '_THEME' }, themeReducer),
  tabs: persistReducer({ storage, key: persisKeys + '_TABS' }, tabsReducer),
});

export default reducer;
